1. Field of the Invention
The present invention relates to a controller of a rotary switch that is used in various electronic equipment, and particularly relates to a controller capable of detecting a failure of a rotary switch.
2. Description of the Related Art
A rotary switch used in various electronic equipment and electric equipment rotates a movable contact to connect the movable contact to any of a plurality of fixed contacts, and outputs a code corresponding to its rotation position, and the rotary switch and its controller generally have a configuration shown in FIG. 1.
FIG. 1 shows an example of the rotary switch in which 4 contacts including fixed contacts SW0 to SW3, 5 terminals, 16 positions, and a 0 V common are used. In a rotary switch 1, the fixed contacts SW0 to SW3 are turned ON/OFF in correspondence to its rotation position (Position), and the rotary switch 1 outputs an output code based on ON/OFF thereof. A contact receiver 3 (3-0, 3-1, 3-2, 3-3) converts contact outputs of the rotary switch 1 to electrical signals, and sends them to input ports PT0 to PT3 of a microcomputer 2. The microcomputer 2 analyzes the output code based on voltage levels of the signals received at the input ports PT0 to PT3, and outputs a command instructed in the rotary switch.
In the case where input ports for a digital signal are used as the input ports PT0 to PT3 of the microcomputer 2, the contact receiver 3 is configured by a pull-up resistor, a low-pass filter, a waveform shaping circuit, and a voltage level conversion circuit, for example. Note that, in analysis by software of the microcomputer 2, when high level signals are input to the input ports PT0 to PT3, it is intuitively determined that the contact of the rotary switch is ON (positive logic), and hence inverters 3-0, 3-1, 3-2, and 3-3 are used in the contact receiver 3 in FIG. 1, but the inversion by the inverters is not essential.
In addition, in the case where the output code of the rotary switch 1 is configured by the Gray code, its output code table is such as the one shown in FIG. 2. In the case where the output code of the rotary switch 1 is configured by the binary code, its output code table is such as the one shown in FIG. 3.
In each of the output code tables in FIGS. 2 and 3, “1” means that the fixed contacts SW0 to SW3 are ON, and “0” means that they are OFF.
An example in which the rotary switch 1 is used includes the case where the rotary switch is used as an override switch that sets the speed of a motor of a machine tool. In this case, the microcomputer 2 reads and analyzes the output code of the rotary switch 1 based on the signals input to the input ports PT0 to PT3, and outputs a speed command (override value). For example, in the case where the output code of the rotary switch 1 is the Gray code shown in FIG. 2, a motor speed command shown in FIG. 4 is output. Note that the output motor speed is expressed in percentage (%) of a reference value in FIG. 4.
In the case where the rotary switch is used as the override switch of the machine tool, when the rotary switch (overdrive switch) 1 fails and outputs an abnormal code, there are cases where the motor rotates at an unintended speed to damage the machine tool or a workpiece and pose a danger.
For example, when the position of the rotary switch is set to “0” in order to stop the motor, in the case where the fixed contact SW3 fails and is in an ON state “1”, and the output code [1000] (SW3=1, SW2=0, SW1=0, SW0=0) is output, and when the output code of the rotary switch is configured by the Gray code output, the speed command (override value) 150% is output from the microcomputer 2. With this, the motor rotates at the unintended speed (a speed corresponding to 150% of the reference speed), which poses a danger.
In order to prevent such a danger and malfunction, a rotary switch 1′ with a parity bit shown in FIG. 5 is used as a method for detecting the failure of the rotary switch.
In the example shown in FIG. 5, a fixed contact SWP of the parity bit (parity bit terminal) is added to the rotary switch 1 shown in FIGS. 1, and 5 contacts, 6 terminals, 16 positions, and the 0 V common are used. Similarly to the fixed contacts SW0 to SW3, the output of the fixed contact SWP of the parity bit is connected to the input port (not shown) of the microcomputer 2 via the contact receiver 3.
In addition, when the output code of the rotary switch 1′ is configured by the Gray code output shown in FIG. 2, the code shown in the output code table in FIG. 6 is output. In this example, the case of an even parity is shown. The microcomputer 2 performs parity check by using software stored in the microcomputer 2, determines that a failure has occurred in the rotary switch when a parity alarm is detected as the result of the parity check, brings the equipment such as the machine tool into a safe state, and performs alarm display or the like.
Note that the prior art that uses the rotary switch with the parity bit is disclosed in, e.g., Japanese Patent Application Laid-open No. 5-63754.
The failure of the rotary switch is detected by using the rotary switch with the parity bit as the rotary switch. However, the rotary switch with the parity bit is large in size, and there is no small rotary switch with the parity bit.